<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div {
        width: 400px;
        height: 200px;
        background-color: aqua;
    }
</style>

<body>
    <div></div>
    <input type="text">
</body>

</html>
<script>
    var div = document.querySelector('div');
    var input = document.querySelector('input');
    div.style.visibility = 'hidden';

    input.addEventListener('keyup', function () {
        div.innerHTML = input.value
        if (this.value != '') {
            div.style.visibility = 'visible';
        }
        input.onblur = function () {
            div.style.visibility = 'hidden';
        }
        input.onfocus = function () {
            div.style.visibility = 'visible'
            if (this.value == '') {
                div.style.visibility = 'hidden'
            }
        }
    })

</script>